#include <iostream>
#include <string>
#include "operand.h"
#include "operatorbinary.h"
#include "variable.h"
#include "vector.h"
#include "assignment.h"

using namespace std;
using namespace AST;

int main(int argc, char **argv)
{
    // Representação: a[10][20] = 1 + 2 * 3;
    // Tokens
    string identifier  = "a";
    string offset1     = "10";
    string offset2     = "20";
    string operand1    = "1";
    string operand2    = "2";
    string operand3    = "3";
    string operator1   = "+";
    string operator2   = "*";
    // Construção
    Operand* x = new Operand(&operand1);
    Operand* y = new Operand(&operand2);
    Operand* z = new Operand(&operand3);
    Operand* off1 = new Operand(&offset1);
    Operand* off2 = new Operand(&offset2);
    OperatorBinary* mul = new OperatorBinary(&operator2, y, z);
    OperatorBinary* add = new OperatorBinary(&operator1, x, mul);
    Variable* a  = new Variable(&identifier);
    Vector* a1 = new Vector(a, off1);
    Vector* a2 = new Vector(a1, off2);
    Assignment* root = new Assignment(a2, add);
    // Renderização
    cout << root->toString(0)  << endl;
    // Execução com Sucesso
    return 0;
}
